﻿/*********************************************************************************/
/**    Sims3Pack Readme Generator                                               **/
/**    Copyright (C) 2012  Anja Knackstedt                                      **/
/**                                                                             **/
/**    This program is free software: you can redistribute it and/or modify     **/
/**    it under the terms of the GNU General Public License as published by     **/
/**    the Free Software Foundation, either version 3 of the License, or        **/
/**    (at your option) any later version.                                      **/
/**                                                                             **/
/**    This program is distributed in the hope that it will be useful,          **/
/**    but WITHOUT ANY WARRANTY; without even the implied warranty of           **/
/**    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            **/
/**    GNU General Public License for more details.                             **/
/**                                                                             **/
/**    You should have received a copy of the GNU General Public License        **/
/**    along with this program.  If not, see <http://www.gnu.org/licenses/>.    **/
/**                                                                             **/
/*********************************************************************************/





using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Sims3PackReadmeGenerator.ContentDesciption;
using Sims3PackReadmeGenerator.Sims3PackReader;

namespace Sims3PackReadmeGenerator.Gui
{
    /// <summary>
    /// form for displaying unknown packages details
    /// </summary>
    partial class UnknownPackagesDetailsGui : Form
    {
        #region events

        public delegate void UnknownPackagesFormEventHandler(object sender, EventArgs e);
        public event UnknownPackagesFormEventHandler OnFormClosingHandler;

        protected void OnFormClosing()
        {
            if (OnFormClosingHandler != null)
                OnFormClosingHandler(this, new EventArgs());
        }

        #endregion

        #region constructor

        /// <summary>
        /// initializes the form
        /// fills the datagrid with values from the fileList
        /// </summary>
        /// <param name="fileList"></param>
        public UnknownPackagesDetailsGui(List<PackagedFileDescription> fileList, Languages lang)
        {
            InitializeComponent();
            foreach (PackagedFileDescription item in fileList)
            {
                dataGridUnknownPackages.Rows.Add(item.Guid, ReferenceResolver.ContentTypeToString(item.ContentType, lang));
            }
            lblPackageCount.Text = fileList.Count.ToString();            
        }

        #endregion

        #region methods

        /// <summary>
        /// handles the form load event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UnknownPackagesDetailsGui_Load(object sender, EventArgs e)
        {
            btCloseUnknownPack.Focus();
        }

        /// <summary>
        /// handles the form closing event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UnknownPackagesDetailsGui_FormClosing(object sender, FormClosingEventArgs e)
        {
            OnFormClosing();
        }
       
        /// <summary>
        /// handles the clos button event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btCloseUnknownPack_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        #endregion

        

    }
}
